<%@page import="com.ilibrary.web.vo.NewsVO"%>
<%@page import="java.util.List"%>
<%@page import="com.ilibrary.constants.MyConstants"%>
<%@page import="com.ilibrary.web.vo.UserInfoVO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新闻中心</title>
<%@include file="../_common.jsp" %>
<link href="<%=request.getContextPath()%>/template_css/index/index.css" rel="stylesheet" type="text/css">
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/template_css/search/base.css">
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/template_css/search/main.css">
</head>

<%
	UserInfoVO loginUser = (UserInfoVO)request.getSession().getAttribute(MyConstants.ILIBRARY_lOGIN_USER);
	List<NewsVO> newsVOList = (List<NewsVO>)request.getAttribute("newsVOList");
	String newsCategoryId = (String)request.getAttribute("newsCategoryId");
%>

<body onload="init()">
	<div class="warp">
		<div class="head_index">
			<span class="logo">
				<img src="<%=request.getContextPath() %>/template_images/index/logo_3.png">
			</span>
			<form id="clientLoginForm" action="<%=request.getContextPath() %>/doLogin.action" method="post">
			<span class="note">
				<p style="text-align: right;">
					<a href="javascript: void(0)" target="_blank">
						<img src="<%=request.getContextPath() %>/template_images/index/lg.gif" align="absmiddle">
					</a>
				</p>
				<%
				if(loginUser == null) {
				%>
				<p style="text-align: right;">
					<span id="loginm">
						学工号 <span id="usnm">
								<input name="userId" id="userId" onkeypress="huiche(event,6)" type="text">
							</span>
						密码 <span id="pswd">
								<input name="userPassword" id="userPassword" onkeypress="huiche(event,6)" type="password">
							</span>
							<input name="userType" value="<%=MyConstants.ILIBRARY_LOGIN_TYPE_STU%>" type="hidden">
							<span id="loginss" onclick="check_user()">&nbsp;</span>
					</span>
				</p>
				<%
				} else {
				%>
				<p style="text-align: right;">
					<span> 
						欢迎您： <span><a href="<%=request.getContextPath() %>/client/userCenter.action"><%=loginUser.getUserName() %></a>&nbsp;&nbsp;<a onclick="doLogout()" href="javascript: void(0)">退出</a></span> 
					</span>
				</p>
				<%
				}
				%>
			</span>
			</form>
		</div>
	</div>
	<div style="border: 1px solid #CCC;margin-top: 5px;width: 960px;height: auto;overflow: hidden;background-color: #F0F4FB;">
		<div style="float: left;margin-left: 30px;width: 200px;height: 400px;border-right: 1px solid #CCC;">
			<ul style="font-size: 20px;font-weight: bold;">
				<li id="nav_zydt" style="margin-top: 10px;"><a href="<%=request.getContextPath() %>/news/newsCenter.action?newsCategoryId=ZYDT">·资源动态</a></li>
				<li id="nav_fwdt" style="margin-top: 10px;"><a href="<%=request.getContextPath() %>/news/newsCenter.action?newsCategoryId=FWDT"">·服务动态</a></li>
				<li id="nav_tsgdt" style="margin-top: 10px;"><a href="<%=request.getContextPath() %>/news/newsCenter.action?newsCategoryId=TSGDT"">·图书馆动态</a></li>
			</ul>
		</div>
		<div id="centerDiv" style="float: left;margin-left: 30px;width: 600px;height: 400px;padding: 10px;">
			<%
				if(newsVOList != null) {
					NewsVO newsVO = null;
					for(int i=0;i<newsVOList.size();i++) {
						newsVO = newsVOList.get(i);
			%>
				<ul>
					<li style="font-size: 16px;margin-top: 5px;padding: 10px;">
						<div style="float: left;width: 70%;text-align: left;">
							<a target="_blank" href="<%=request.getContextPath() %>/news/newsView.action?newsId=<%=newsVO.getNewsId()%>">
								·<%=newsVO.getNewsTitle() %>
							</a>
						</div>
						<div style="float: left;width: 29%;text-align: right;">
							<font style="text-align: right;font-size: 12px;"><%=newsVO.getCreateDt().toLocaleString() %></font>
						</div>
					</li>
				</ul>
			<%
					}
				}
			%>
		</div>
	</div>
	<div class="foot_index" style="margin-top: 20px;clear: both;">
		<p>航空港校区：成都市双流县西南航空港经济开发区 学府路一段24号 邮编：610225</p>
		<p>
			Copyright 2013 Chengdu University Of Information Technology Library. All Right Reserved 
		</p>
		<p>&nbsp;</p>
	</div>
</body>

<script type="text/javascript">
	function init() {
		var newsCategoryId = '<%=newsCategoryId %>';
		if(newsCategoryId == '' || '<%=newsCategoryId %>' == 'ZYDT') {
			document.getElementById("nav_zydt").style.background = '#CCC';
		}else if('<%=newsCategoryId %>' == 'FWDT') {
			document.getElementById("nav_fwdt").style.background = '#CCC';
		}else if('<%=newsCategoryId %>' == 'TSGDT') {
			document.getElementById("nav_tsgdt").style.background = '#CCC';
		}else {
			document.getElementById("centerDiv").innerHTML = '<div style="font-size: 20px;text-align: center;line-height: 300px;font-weight: bold;">请选择合法的新闻分类!</div>';
		}
	}
</script>

</html>